<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div class="box">
        <div>{{msg1}}</div>
        <!-- 当调用函数没有传参时，表示事件对象的参数$event默认绑定为函数的第一个形参 -->
        <button @click='handles'>我点你</button>
        <!-- 当调用函数有传参时，表示事件对象的参数$event,需放在最后一个函数 -->
        <button v-on:keyup.enter='handle("你是一坨屎",$event)'>嘻嘻</button>
    </div>
    <script>
        let vm = new Vue({
            el: '.box',
            data: {
                msg1: 1,
            },
            methods: {
                handle(p, e) {
                    this.msg1 += 1
                    console.log('想对你说' + p, e.target.innerHTML)
                },
                handles(e) {
                    this.msg1 += 1
                    console.log(e.target.innerHTML)
                }
            }
        })
    </script>
</body>

</html>